--partition by方法取最新记录,一般用于操作日志的查询
--比如某个事件,最后处理的操作日志
select s.keyname,s.description
from (select keyname,description,
row_number() over(partition by keyname order by logtime desc) rn
from sys_log with(nolock) where tablename='d_fault_record') s where s.rn<2
Copyright © TouchNet 2015 all right reserved,powered by Gitbook最后修订时间: 2022-06-21 09:21:02

results matching ""

    No results matching ""